package org.javaweb.cms_web.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.javaweb.cms_web.model.User;

import java.util.List;

@Mapper
public interface UserMapper {

    // 插入用户
    int insertUser(User user);

    //根据用户实际名称查找用户
    User getUserByName(@Param("name") String name);

    // 根据用户名和密码查询用户
    User getUserByNicknameAndPassword(@Param("nickname") String nickname, @Param("password") String password);

    // 根据用户ID查询用户
    User getUserById(@Param("userId") Integer userId);

    // 根据昵称查询用户
    User getUserByNickname(@Param("nickname") String nickname);

    // 根据邮箱查询用户
    User getUserByEmail(@Param("email") String email);

    // 更新用户信息
    int updateUser(User user);

    // 删除用户
    int deleteUser(@Param("userId") Integer userId);

    // 查询所有用户
    List<User> getAllUsers();

    // 根据团队ID查询用户
    List<User> getUsersByTeamId(@Param("teamId") Integer teamId);

    // 根据邮箱查询用户
    User selectUserByEmail(@Param("email") String email);

    List<User> getAllTeamAdmins();

    List<User> selectUsersByTeamId(Integer teamId);

    List<User> findUsersForReview(Integer teamId);
}